package com.mvvm.store.roombatabase;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.mvvm.store.bean.basebean.IntoMaterialBean;
import com.mvvm.store.bean.basebean.MaterialInfoBean;

@Database(entities = {IntoMaterialBean.class},version=1,exportSchema = false)
public abstract class IntoMaterDatabase extends RoomDatabase {

private static final String DB_NAME = "IntoMaterialDatabase.db";
private static volatile IntoMaterDatabase instance;

public static synchronized IntoMaterDatabase getInstance(Context context) {
    if (instance == null) {
        instance = create(context);
    }
    return instance;
}

private static IntoMaterDatabase create(final Context context) {
    return Room.databaseBuilder(
            context,
            IntoMaterDatabase.class,
            DB_NAME)
            .allowMainThreadQueries()
            .build();

}



    public abstract IntoMaterialDao materialDao();


}
